﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Cherry.Agile.RpcService.Client
{
    /// <summary>
    /// 向业务请求采集器配置参数
    /// </summary>
    public class CollectorSettingRequest : ClientRequest
    {
        public byte[] GetConfigData(int AppId,ConfigCollectorType configType,int patientId, int collectorType)
        {
            base.BusinessCode = (short)AppId;
            base.FunctionCode = (short)configType;
            base.OnWriteRequest = (writer) =>
            {
                writer.Write(patientId);
                writer.Write(collectorType);
            };
            byte[] resultData=new byte[]{};
            base.OnReadResponse = reader =>
            {
                if (IsNormal)
                {
                    //int len= reader.RemainLength;
                    int len = reader.ReadInt32();
                    resultData = reader.ReadBytes(len);
                }
            };
            base.Process();
            return resultData;
        }
    }

    /// <summary>
    /// 采集器配置类型（对应功能码）
    /// </summary>
    public enum ConfigCollectorType: short
    {
        /// <summary>
        /// 采集器发放类别
        /// </summary>
        AssignCollector=9996,

        /// <summary>
        /// 收回
        /// </summary>
        RecoverCollector=9997,

        /// <summary>
        /// 配置参数
        /// </summary>
        SetParameter=9998,

    }
}
